package cn.tedu.deviceservice.canal;

import cn.tedu.deviceservice.pojo.vo.ChargingStationCanalPO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import top.javatool.canal.client.annotation.CanalTable;
import top.javatool.canal.client.handler.EntryHandler;
@Slf4j
@Component
//同步mysql的那张表
@CanalTable("charging_station")
public class StationSync implements EntryHandler<ChargingStationCanalPO> {
    @Autowired
    private RedisTemplate redisTemplate;

    @Override
    public void insert(ChargingStationCanalPO chargingStationCanalPO) {
        EntryHandler.super.insert(chargingStationCanalPO);
        log.debug("获取新增信息:{}",chargingStationCanalPO);

        //获取到信息,对redis进行对应操作
    }

    @Override
    public void delete(ChargingStationCanalPO chargingStationCanalPO) {
        EntryHandler.super.delete(chargingStationCanalPO);
        log.debug("获取删除信息:{}",chargingStationCanalPO);

    }

    @Override
    public void update(ChargingStationCanalPO before, ChargingStationCanalPO after) {
        EntryHandler.super.update(before, after);
        log.debug("获取更新前信息:{}",before);
        log.debug("获取更新后信息:{}",after);

    }
}
